library(ggplot2) #Esta librería nos permitira hacer graficas bonitas
library(ggmap) #Esta librería nos permitirá hacer mapas
## Google's Terms of Service: https://cloud.google.com/maps-platform/terms/.
## Please cite ggmap if you use it! See citation("ggmap") for details.
library(plotly) #esta grafica nos permitira hacer graficas interactivas
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggmap':
##
## wind
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
Día<-1:7
LONGITUD<-sample(seq(-156.7,-156.6,0.01), 7,T)
LATITUD<-sample(seq(20.8,21.9,0.01), 7, T)
gps<-data.frame(Día,LONGITUD,LATITUD)
gps
## Día LONGITUD LATITUD
## 1 1 -156.67 21.67
## 2 2 -156.60 21.89
## 3 3 -156.69 21.86
## 4 4 -156.70 20.91
## 5 5 -156.60 20.85
## 6 6 -156.67 21.19
## 7 7 -156.62 21.15
ruta_del_infiel<-ggplot(gps)+geom_point(aes(x=LONGITUD,y=LATITUD),color=Día)
ruta_del_infiel
ruta_del_infiel_con_días<-ggplot(gps)+geom_text(aes(LONGITUD,LATITUD,label = Día))
ruta_del_infiel_con_días
ggplotly(ruta_del_infiel_con_días)
qmplot(LONGITUD,LATITUD, data = gps)
## Using zoom = 13...
## 84 tiles needed, this may take a while (try a smaller zoom).
## Source : http://tile.stamen.com/terrain/13/530/3584.png
## Source : http://tile.stamen.com/terrain/13/531/3584.png
## Source : http://tile.stamen.com/terrain/13/532/3584.png
## Source : http://tile.stamen.com/terrain/13/530/3585.png
## Source : http://tile.stamen.com/terrain/13/531/3585.png
## Source : http://tile.stamen.com/terrain/13/532/3585.png
## Source : http://tile.stamen.com/terrain/13/530/3586.png
## Source : http://tile.stamen.com/terrain/13/531/3586.png
## Source : http://tile.stamen.com/terrain/13/532/3586.png
## Source : http://tile.stamen.com/terrain/13/530/3587.png
## Source : http://tile.stamen.com/terrain/13/531/3587.png
## Source : http://tile.stamen.com/terrain/13/532/3587.png
## Source : http://tile.stamen.com/terrain/13/530/3588.png
## Source : http://tile.stamen.com/terrain/13/531/3588.png
## Source : http://tile.stamen.com/terrain/13/532/3588.png
## Source : http://tile.stamen.com/terrain/13/530/3589.png
## Source : http://tile.stamen.com/terrain/13/531/3589.png
## Source : http://tile.stamen.com/terrain/13/532/3589.png
## Source : http://tile.stamen.com/terrain/13/530/3590.png
## Source : http://tile.stamen.com/terrain/13/531/3590.png
## Source : http://tile.stamen.com/terrain/13/532/3590.png
## Source : http://tile.stamen.com/terrain/13/530/3591.png
## Source : http://tile.stamen.com/terrain/13/531/3591.png
## Source : http://tile.stamen.com/terrain/13/532/3591.png
## Source : http://tile.stamen.com/terrain/13/530/3592.png
## Source : http://tile.stamen.com/terrain/13/531/3592.png
## Source : http://tile.stamen.com/terrain/13/532/3592.png
## Source : http://tile.stamen.com/terrain/13/530/3593.png
## Source : http://tile.stamen.com/terrain/13/531/3593.png
## Source : http://tile.stamen.com/terrain/13/532/3593.png
## Source : http://tile.stamen.com/terrain/13/530/3594.png
## Source : http://tile.stamen.com/terrain/13/531/3594.png
## Source : http://tile.stamen.com/terrain/13/532/3594.png
## Source : http://tile.stamen.com/terrain/13/530/3595.png
## Source : http://tile.stamen.com/terrain/13/531/3595.png
## Source : http://tile.stamen.com/terrain/13/532/3595.png
## Source : http://tile.stamen.com/terrain/13/530/3596.png
## Source : http://tile.stamen.com/terrain/13/531/3596.png
## Source : http://tile.stamen.com/terrain/13/532/3596.png
## Source : http://tile.stamen.com/terrain/13/530/3597.png
## Source : http://tile.stamen.com/terrain/13/531/3597.png
## Source : http://tile.stamen.com/terrain/13/532/3597.png
## Source : http://tile.stamen.com/terrain/13/530/3598.png
## Source : http://tile.stamen.com/terrain/13/531/3598.png
## Source : http://tile.stamen.com/terrain/13/532/3598.png
## Source : http://tile.stamen.com/terrain/13/530/3599.png
## Source : http://tile.stamen.com/terrain/13/531/3599.png
## Source : http://tile.stamen.com/terrain/13/532/3599.png
## Source : http://tile.stamen.com/terrain/13/530/3600.png
## Source : http://tile.stamen.com/terrain/13/531/3600.png
## Source : http://tile.stamen.com/terrain/13/532/3600.png
## Source : http://tile.stamen.com/terrain/13/530/3601.png
## Source : http://tile.stamen.com/terrain/13/531/3601.png
## Source : http://tile.stamen.com/terrain/13/532/3601.png
## Source : http://tile.stamen.com/terrain/13/530/3602.png
## Source : http://tile.stamen.com/terrain/13/531/3602.png
## Source : http://tile.stamen.com/terrain/13/532/3602.png
## Source : http://tile.stamen.com/terrain/13/530/3603.png
## Source : http://tile.stamen.com/terrain/13/531/3603.png
## Source : http://tile.stamen.com/terrain/13/532/3603.png
## Source : http://tile.stamen.com/terrain/13/530/3604.png
## Source : http://tile.stamen.com/terrain/13/531/3604.png
## Source : http://tile.stamen.com/terrain/13/532/3604.png
## Source : http://tile.stamen.com/terrain/13/530/3605.png
## Source : http://tile.stamen.com/terrain/13/531/3605.png
## Source : http://tile.stamen.com/terrain/13/532/3605.png
## Source : http://tile.stamen.com/terrain/13/530/3606.png
## Source : http://tile.stamen.com/terrain/13/531/3606.png
## Source : http://tile.stamen.com/terrain/13/532/3606.png
## Source : http://tile.stamen.com/terrain/13/530/3607.png
## Source : http://tile.stamen.com/terrain/13/531/3607.png
## Source : http://tile.stamen.com/terrain/13/532/3607.png
## Source : http://tile.stamen.com/terrain/13/530/3608.png
## Source : http://tile.stamen.com/terrain/13/531/3608.png
## Source : http://tile.stamen.com/terrain/13/532/3608.png
## Source : http://tile.stamen.com/terrain/13/530/3609.png
## Source : http://tile.stamen.com/terrain/13/531/3609.png
## Source : http://tile.stamen.com/terrain/13/532/3609.png
## Source : http://tile.stamen.com/terrain/13/530/3610.png
## Source : http://tile.stamen.com/terrain/13/531/3610.png
## Source : http://tile.stamen.com/terrain/13/532/3610.png
## Source : http://tile.stamen.com/terrain/13/530/3611.png
## Source : http://tile.stamen.com/terrain/13/531/3611.png
## Source : http://tile.stamen.com/terrain/13/532/3611.png
### Podemos cambiar el color y tamaño de los puntos de nuestro mapa agregando los parametros ‘color’ y’size’ : # 7. Tuneando el mapa.
qmplot(LONGITUD,LATITUD,data = gps,color = Día, size = I(2))
## Using zoom = 13...
## 84 tiles needed, this may take a while (try a smaller zoom).
Podemos agregar el parametro ‘geo=c(“point”, “density2d”)’ para hacer un mapa de puntos y densidad.:
qmplot(LONGITUD,LATITUD,data = gps,geom = c("point","density2d"))
## Using zoom = 13...
## 84 tiles needed, this may take a while (try a smaller zoom).
# Tutorial